package com.github.ikidou.cqj;

import com.github.ikidou.entity.MachineCoupon;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by jon on 17-9-24.
 */

public class Test2 {

    public static void main(String[] args) {
        Gson gson = new GsonBuilder()
                .setDateFormat("yyyy-MM-dd hh:mm:ss")
                .create();
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Contanst.cqjUrl)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
        Call<MachineCoupon> call = retrofit.create(ApiServcie.class).getConvertCoupon();
        call.enqueue(new Callback<MachineCoupon>() {
            @Override
            public void onResponse(Call<MachineCoupon> call, Response<MachineCoupon> response) {
                System.out.println(response.body());
            }

            @Override
            public void onFailure(Call<MachineCoupon> call, Throwable t) {

            }
        });


    }
}

